import { request } from "umi";

/**
 * 获取 模块
 * @param params
 * @returns
 */
export function get_modules_list(
  params: Types.Modules.ModulesSearch
): Promise<Types.Http.Response<Types.Modules.IModulesList>> {
  return request(`/api/v1/admin/modules/list`, { params });
}

/**
 * 获取 详情
 * @param params
 * @returns
 */
export function get_modules_detail(id: string): Promise<Types.Http.Response<any>> {
  return request("/api/v1/admin/modules/detail/" + id);
}

/**
 * 新增
 * @param data
 * @returns
 */
export function add_modules(data: any): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/modules/create", { data, method: "post" });
}

/**
 * 编辑
 * @param data
 * @returns
 */
export function edit_modules(data: any): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/modules/edit", { data, method: "post" });
}
